-
Notifications
You must be signed in to change notification settings - Fork 1
feat: user-agent
sent to mgmt api
#54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds optional userAgent propagation from the CLI to the create-db worker and then to the Prisma API via a User-Agent header. Adjusts the CLI payload to always set utm_source to CLI_NAME and, when provided, include a top-level userAgent field. No changes to exported APIs or existing control flow. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant CLI as CLI (create-db)
participant Worker as create-db-worker /create
participant Prisma as Prisma API
CLI->>Worker: POST /create { region, name, userAgent? }<br/>utm_source=CLI_NAME
Worker->>Worker: Extract userAgent (optional)
Worker->>Prisma: POST /databases { region, name }<br/>Header: User-Agent = userAgent || ""
Prisma-->>Worker: Response (created/error)
Worker-->>CLI: Response passthrough
Possibly related PRs
Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Preview CLIs & Workers are live! Test the CLIs locally under tag npx create-db@pr54
npx create-pg@pr54
npx create-postgres@$pr54 Worker URLs
|
Deploying with
|
Status | Name | Latest Commit | Preview URL | Updated (UTC) |
---|---|---|---|---|
✅ Deployment successful! View logs |
claim-db-worker | 5041be3 | Commit Preview URL Branch Preview URL |
Sep 05 2025, 07:03 PM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
create-db/index.js (2)
518-518
: UTM consistency: keep utm_source stable (use CLI_NAME), move UA to utm_contentclaimUrl currently sets utm_source to userAgent when present, diverging from the new convention. Standardize utm_source to CLI_NAME and, if desired, carry the UA via utm_content.
Apply:
- const claimUrl = `${CLAIM_DB_WORKER_URL}/claim?projectID=${projectId}&utm_source=${userAgent || CLI_NAME}&utm_medium=cli`; + const claimUrl = + `${CLAIM_DB_WORKER_URL}/claim?projectID=${projectId}` + + `&utm_source=${CLI_NAME}&utm_medium=cli` + + (userAgent ? `&utm_content=${encodeURIComponent(userAgent)}` : "");
411-417
: Normalize analytics property casing for UAYou use "user-agent" in analytics payloads but userAgent elsewhere. Consider standardizing on userAgent for consistency across the codebase and analytics dashboards. Low-risk, optional.
Also applies to: 455-462, 485-491, 555-561, 635-651
create-db-worker/src/index.ts (1)
51-61
: Consider forwarding UA on regions fetch (optional)If correlating UA across flows is useful, consider also passing sanitized UA (when present) to the /regions call for consistency. Not required for correctness.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
create-db-worker/src/index.ts
(2 hunks)create-db/index.js
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
create-db-worker/src/index.ts (1)
create-db/index.js (1)
userAgent
(629-629)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Workers Builds: claim-db-worker
- GitHub Check: Workers Builds: create-db-worker
🔇 Additional comments (1)
create-db/index.js (1)
434-436
: User-Agent propagation looks correctAdding a top-level userAgent while keeping utm_source fixed to CLI_NAME matches the PR goal and won’t break existing consumers (undefined is omitted by JSON.stringify).
Summary by CodeRabbit